﻿using LayuiMvc.DataEntity.DataEnum;
using LayuiMvc.Util.EnumUtil;
using LayuiMvc.Util.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LayuiMvc.DataModel.Community
{
    public class UserCenterModel
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        public int UserId { get; set; }

        /// <summary>
        /// 昵称
        /// </summary>
        public string NickName { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public int Sex { get; set; }

        /// <summary>
        /// 用户头像
        /// </summary>
        public string HeadImgUrl { get; set; }

        /// <summary>
        /// 身份标识
        /// </summary>
        public UserIdentityEnum UserIdentity { get; set; }

        public string UserIdentityStr
        {
            get { return EnumExtend.GetDescription(UserIdentity); }
        }

        /// <summary>
        /// 是否认证
        /// </summary>
        public bool IsApprove { get; set; }

        /// <summary>
        /// 认证信息
        /// </summary>
        public string ApproveMsg { get; set; }

        /// <summary>
        /// 注册时间
        /// </summary>
        public DateTime RegisterTime { get; set; }

        /// <summary>
        /// 用户介绍
        /// </summary>
        public string Instrduce { get; set; }

        /// <summary>
        /// 用户发布帖子列表
        /// </summary>
        public List<PostPublishModel> PublishList { get; set; }

        /// <summary>
        /// 用户回复的帖子列表
        /// </summary>
        public List<PostReplyModel> ReplyList { get; set; }
    }
     
    /// <summary>
    /// 帖子发布模型类
    /// </summary>
    public class PostPublishModel
    {
        /// <summary>
        /// 帖子Id
        /// </summary>
        public int PostId { get; set; }

        /// <summary>
        /// 帖子标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 发布时间
        /// </summary>
        public DateTime PublishTime { get; set; }

        public string PublishTimeSpan
        {
            get { return TimeSpanHelper.GetTimeSpan(this.PublishTime); }
        }

        /// <summary>
        /// 是否置顶
        /// </summary>
        public bool IsTop { get; set; }

        /// <summary>
        /// 是否精华
        /// </summary>
        public bool IsCream { get; set; }

        /// <summary>
        /// 回复数量
        /// </summary>
        public int ReplyCount { get; set; }

        /// <summary>
        /// 浏览数量
        /// </summary>
        public int ViewCount { get; set; }
    }

    /// <summary>
    /// 帖子回复模型类
    /// </summary>
    public class PostReplyModel
    {
        /// <summary>
        /// 回复内容Html
        /// </summary>
        public string HtmlContent { get; set; }

        /// <summary>
        /// 回复时间
        /// </summary>
        public DateTime ReplyTime { get; set; }

        /// <summary>
        /// 帖子Id
        /// </summary>
        public int PostId { get; set; }

        /// <summary>
        /// 帖子标题
        /// </summary>
        public string Title { get; set; }

        public string ReplyTimeTimeSpan
        {
            get { return TimeSpanHelper.GetTimeSpan(this.ReplyTime); }
        }
    }
}
